<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>用户注册</title>
    <link href="assets/css/register.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/public.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/fa47/css/font-awesome.css" rel="stylesheet" type="text/css" />
    <script src="assets/js/jquery2-1.min.js"></script>
    <script>
        $(document).ready(function () {
            $("#formReg").submit(function(){
                //获取两个密码框的内容
                var pwd=$("#tbPWD").val();
                var pwdConfirm=$("#tbPWDConfirm").val();
                if(pwd==pwdConfirm){
                    $(document).ready(function(){
                    $.ajax({
                    "url":"http://kjxycode.zisu.edu.cn/InterfaceCommonForUser/InsertUser",
                    "type":"post",
                    "data":{
                        "userPhone":$("#tbPhone").val(),
                        "userPwd":$("#tbPWD").val(),
                        "userName":$("#tbPWDConfirm").val(),
                        "userNickName":$("#tbNickName").val(),
                        "token":"kjxy_Interface_2025"
                    },
                    "dataType":"json",
                    success:function(e){
                        if(e.status==600){
                            alert("注册成功！");
                            window.location.href="default.html";
                        }else{
                            alert("注册失败【"+e.status+"】【"+e.msg+"】");
                        }
                    }
                });
            })
        }
            return false;
            });
         
        })
    </script>
</head>

<body>
    <div class="container">
        <div class="avatar">
            <img src="assets/img/avatar.png" />
        </div>
        <div class="regContainer">
            <form method="post" name="formReg" id="formReg" action="#">
                <div><input type="text" id="tbPhone" placeholder="请输入有效手机号" required pattern="^1[35789][0-9]{9}$" title="有效的手机号格式" />
                </div>
                <div><input name="tbPWD" id="tbPWD" type="password" placeholder="6-20个字符" required
                        pattern="^[a-zA-Z][a-zA-Z0-9_]{5,19}$" /></div>
                <div><input name="tbPWDConfirm" id="tbPWDConfirm" type="password" placeholder="请再次输入密码" required />
                </div>
                <div><i class="fa fa-users"></i><input type="text" id="tbNickName" required class="tbNickName" placeholder="站内昵称" />
                </div>
                <div class="hide"><input type="checkbox" />记住我</div>
                <div><button id="btnTest">我要注册</button></div>
            </form>
        </div>
        <div id="divMsg" style="text-align: center;padding-top:15px;color:rgb(143, 5, 5);"></div>
    </div>
</body>

</html>